﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using System.Data;

namespace logic
{
   public class buyerFixedPricePeriod
    {
       public static int BuyerFixedPricePeriod_WithCountByDatetime(int comapanyid,Nullable<DateTime> times)
       {
           return DAL.BuyerFixedPricePeriod.BuyerFixedPricePeriod_WithCountByDatetime(comapanyid,times); 
       }
       public static int insert(BuyerFixedPricePeriodEntity bfp)
       {
           return BuyerFixedPricePeriod.insert(bfp);
       }
       public static DataSet select(string where, string orderby, int pagesize, int pageindex)
       {
           return DAL.DbHelper.ExecuteDataSetPageSize("fpid, buyerid, buyerName, startTime, endTime, inputDt, createAdminId, inputName, checkName, status, statusName, updateStatusDt, auditAdminId", "vw_BuyerFixedPricePeriod_list", where, "orderid", orderby, pagesize, pageindex);
       }
       public static bool ifExistByBuyerIdAndTime(int buyerId, DateTime startTime, DateTime endTime)
       {
           return BuyerFixedPricePeriod.ifExistByBuyerIdAndTime(buyerId,startTime,endTime);
       }
       public static DataRow getLastperiodBybuyerid(int buyerId)
       {
           return BuyerFixedPricePeriod.getLastperiodBybuyerid(buyerId);
       }
       /// <summary>
       /// 判断新修改的收货日期是否是有效日期
       /// </summary>
       /// <param name="orderId">订单号</param>
       /// <param name="newReceiveDt">新的收货日期</param>
       /// <returns></returns>
       public static bool isValidReceiveDt(int orderId, DateTime newReceiveDt)
       {
           return BuyerFixedPricePeriod.isValidReceiveDt(orderId, newReceiveDt);
       }
    }
}
